<template>
  <el-row>
    <div class="buttonLeft">
      <template v-for="item in mainButton">
        <el-button
          :key="item.label"
          :icon="item.icon"
          :type="item.type"
          @click="item.handle()"
        >
          {{ item.label }}
        </el-button>
      </template>
      <el-dropdown v-if="isShowFilse" style="margin-left:10px">
        <el-button type="warning">
          档案迁移<i class="el-icon-arrow-down el-icon--right"></i>
        </el-button>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>批量迁入</el-dropdown-item>
          <el-dropdown-item>批量迁出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
    <div class="buttonRight">
      <el-button type="primary" @click="searchHandle">查询</el-button>
      <el-button type="primary" @click="resetHandle">重置</el-button>
    </div>
  </el-row>
</template>

<script>
import { eventBus } from "@/main.js"
export default {
  name: "MainButton",
  props: {
    mainButton: {
      type: Array,
      default: () => {
        return []
      }
    },
    isShowFilse: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {}
  },
  mounted() {},
  methods: {
    advancedSearchHandle() {
      this.$emit("advanced-search-handle", "commonForm")
    },
    // 点击查询按钮
    searchHandle() {
      this.$emit("toMainSearch", "commonForm")
    },
    // 点击重置按钮
    resetHandle() {
      this.$emit("toMainSearchReset", "commonForm")
    }
  }
}
</script>

<style lang="scss" scoped>
.el-row {
  // display: flex;
  // justify-content: space-between;
  .buttonLeft {
    float: left;
  }
  .buttonRight {
    float: right;
  }
}
</style>
